主题
截图GIF - CaptureGif
函数简介
抓取指定区域的动画并保存为GIF格式,当delay参数为0时只截取静态图片。
接口名称
CaptureGifDLL调用
int CaptureGif(long ola, int x1, int y1, int x2, int y2, string file, int delay, int time);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| x1 | 整数型 | 区域的左上X坐标。 |
| y1 | 整数型 | 区域的左上Y坐标。 |
| x2 | 整数型 | 区域的右下X坐标。 |
| y2 | 整数型 | 区域的右下Y坐标。 |
| file | 字符串 | 保存的文件名,使用相对路径时保存在SetPath设置的目录下。 |
| delay | 整数型 | 动画帧间隔(毫秒),为0时只截取静态图片。 |
| time | 整数型 | 总共截取的时间(毫秒)。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// 截取绑定窗口客户区并保存为 GIF
int ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000);csharp
using OLAPlug;
var ola = new OLAPlugServer();
// 截取绑定窗口客户区并保存为 GIF
int ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
# 截取绑定窗口客户区并保存为 GIF
ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
// 截取绑定窗口客户区并保存为 GIF
int ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000);go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
// 截取绑定窗口客户区并保存为 GIF
ret := ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000)rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
// 截取绑定窗口客户区并保存为 GIF
let ret = ola.capture_gif(0, 0, 0, 0, "capture.gif", 100, 3000);cpp
var ola = com("OlaPlug.OlaSoft")
// 截取绑定窗口客户区并保存为 GIF
var ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' 截取绑定窗口客户区并保存为 GIF
ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000)text
.局部变量 ola, OLAPlug
ola.创建 ()
' 截取绑定窗口客户区并保存为 GIF
ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// 截取绑定窗口客户区并保存为 GIF
var ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// 截取绑定窗口客户区并保存为 GIF
整数 ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// 截取绑定窗口客户区并保存为 GIF
int ret = ola.CaptureGif(0, 0, 0, 0, "capture.gif", 100, 3000);原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
int ret = CaptureGif(instance, 0, 0, 0, 0, "capture.gif", 100, 3000);csharp
long instance = CreateCOLAPlugInterFace();
int ret = CaptureGif(instance, 0, 0, 0, 0, "capture.gif", 100, 3000);python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ret = CaptureGif(instance, 0, 0, 0, 0, "capture.gif", 100, 3000)返回值
| 返回值 | 说明 |
|---|---|
1 | 成功。 |
0 | 失败。 |
注意事项
| 项目 | 说明 |
|---|---|
| delay参数为0时只截取静态图片 | delay参数为0时只截取静态图片。 |
| delay参数不要设置太小 | 建议delay参数不要设置太小,否则GIF文件过大。 |
